<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>个人页面</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/Content/script/jquery-1.10.2.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/Content/script/jquery.validate.js"></script>
<script type="text/javascript">
	$(function(){
		$("#form").validate({
			rules:{
				password:{
					required:true},
				confirm:{
					required:true,
					equalTo:"#password"},
				nickname:{
					required:true
				}
			},
			messages:{
				password:{
					required:"请输入密码"
					},
				confirm:{
					required:"请再次输入密码",
					equalTo:"两次输入密码须一致"
				},
				nickname:{
					required:"请输入昵称"
				}
				}
		});	
		
		//点击图片后预览
		

	});
</script>
<style>
label.error{color:red}
</style>
    <!-- Bootstrap -->
    <link href="<c:url value='/Content/bootstrap/css/bootstrap.min.css'/>" rel="stylesheet">
</head>
<body>
<div class="container">
    <%@ include file="../shared/header.jsp"%>
    <div id="path">
        <ol class="breadcrumb">
            <li><a href="IndexServlet">首页</a></li>
            <li><a href="register.html">发表主题</a></li>
        </ol>
    </div>
    <div id="content">
        <form class="form-horizontal" method="post" action="PersonalDataServlet" enctype="multipart/form-data" id="form">
            <div class="form-group">
                <label class="col-sm-2 control-label">上传头像</label>
                <div class="col-sm-6">
                    <img src="${pageContext.request.contextPath}/Content/pictures/user/${filename }" id="show"/>
                    <input type="file" id="img" name="photo">
                </div>
                <label class="error">${error }</label>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="username" value="${user.username }" disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">密码</label>
                <div class="col-sm-6">
                    <input type="password" class="form-control" id="password" name="password" placeholder="密码">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">密码确认</label>
                <div class="col-sm-6">
                    <input type="password" class="form-control"  name="confirm" placeholder="密码确认">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">昵称</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" value="${user.nickname }" name="nickname" placeholder="昵称">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">个性签名</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" value="${user.signature }" name="signature" placeholder="个性签名">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">积分</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" value="${user.grade }" name="score" disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">Email</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" value="${user.email }" name="email" disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">修改</button>
                    <a href="IndexServlet"><button type="button" class="btn btn-default">回到首页</button></a>
                </div>
            </div>
        </form>
    </div>
    <%@ include file="../shared/footer.jsp"%>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="Content/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>